package com.lfd.controller;





import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lfd.entity.DiZhi;
import com.lfd.mapper.IDZMapper;
import com.lfd.service.DZService;
import com.lfd.util.Result;
import com.lfd.vo.DiZhiVo;


@Controller
@RequestMapping("/dz")
public class DZController {
	
	private Logger logger = Logger.getLogger(DZController.class);
	
	@Autowired
	private  DZService  dZService;
	
	/**
	 * 查询所有
	 * @param iDZMapper
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/list")
	public Result selectList(DiZhiVo diZhiVo) {
		List<DiZhiVo> selectList =null;
	try {
		selectList=dZService.selectList(diZhiVo);
	} catch (Exception e) {
		
		logger.error("失败",e);
		return new Result("1","失败");
	}
	
		return new Result("0", "成功",selectList.size(),selectList);
	}
	
	 @ResponseBody
	 @RequestMapping("/shanchu")
	 public Result shanchu(Long sid) {
		  try {
			
			dZService.shanchu(sid);
		  } catch (Exception e) {
			 
			  return new Result("1","删除地址失败");
		  }
		  return new Result("0","删除地址成功");
	 }
	
	
}
